package com.ZengQi.event.controller;

import com.ZengQi.event.entity.Comment;
import com.ZengQi.event.entity.Finish;
import com.ZengQi.event.entity.User;
import com.ZengQi.event.service.CommentService;
import com.ZengQi.event.service.FinishService;
import com.ZengQi.event.service.UserService;
import com.ZengQi.event.service.impl.CommentServiceImpl;
import com.ZengQi.event.service.impl.FinishServiceImpl;
import com.ZengQi.event.service.impl.UserServiceImpl;

public class UserInformationController {
    private UserService userService=new UserServiceImpl();
    private FinishService finishService=new FinishServiceImpl();
    private CommentService commentService=new CommentServiceImpl();


    public User getUserInformation(String userName){
        User conditionUser=new User();
        conditionUser.setUserName(userName);
        return userService.findUserByUserName(conditionUser);
    }
    public boolean update(User user, String oldUserName, Finish finish, String oldFinisher, Comment comment,String oldCommentPublisher){
        boolean x1=userService.modifyUserByLoginName(user,oldUserName);
        boolean x2=finishService.modifyFinishByFinisher(finish,oldFinisher);
        boolean x3=commentService.modifyCommentByCommentPublisher(comment,oldCommentPublisher);

        return x1||x2||x3;
    }
    public boolean userNameIsExit(User conditionUser){
        return userService.findIsExistUserName(conditionUser);
    }
}
